//////////////////////////////////////////////////////////////////////////////////
// Company: 
// Engineer: 
// 
// Create Date: 2021/07/20 00:56:38
// Design Name: 
// Module Name: jalr_data_forward
// Project Name: 
// Target Devices: 
// Tool Versions: 
// Description: 
// 
// Dependencies: 
// 
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
// 
//////////////////////////////////////////////////////////////////////////////////


module jalr_data_forward(
    input [4:0] rR1,
    input [4:0] ID_EX_wR,
    input [4:0] EX_MEM_wR,
    input [31:0] ALUd,
    input [31:0] EX_MEM_MUXd,
    input [31:0] rD1,
    input ID_EX_WB,
    input EX_MEM_WB,
    output [31:0] rD1_b
    );
    
    assign rD1_b    =   (rR1==ID_EX_wR & rR1!=5'b0 & ID_EX_WB==1'b1)    ?    ALUd:
                        (rR1==EX_MEM_wR & rR1!=5'b0 & EX_MEM_WB==1'b1)   ?    EX_MEM_MUXd:
                                                rD1;
                                                
                                                  
endmodule
